import { createRouter, createWebHashHistory, RouteRecordRaw, } from 'vue-router'

const hidden = true

const routes:Array<RouteRecordRaw> = [
    {
        path : '/',
        name : 'monitor',
        component : () => import('../views/operate/index.vue'),
        meta : { title : '运营监控平台', hidden}
    }
]

let router = createRouter({
    history: createWebHashHistory(),
    routes
})


interface To {
    meta : {
        title? : string;
        [key:string]:any;
    };

    [key:string]:any;
}

router.beforeEach((to:To, from) => {
    if(to.meta && to.meta.title !== undefined) {
        document.title = to.meta.title || '运营监控平台'
    }
    
})

export default router

export {
    routes
}